#include "WinException.h"

using namespace std;

WinException::WinException( string tag, int errorCode) 
	:Exception(tag + " " + getErrorText(errorCode))
{}


string WinException::getErrorText(DWORD errorCode)
 {
	char buf[512];
	
	int numChars = ::FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, errorCode,  LANG_SYSTEM_DEFAULT , buf, 512, 0);
	return to_string(errorCode) + "\n" + string(buf);
}